//首页
const express = require('express')
//引入连接池
const pool = require('../pool')
const router = express.Router()
router.get('/sc_hot_city/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from sc_hot_city', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '热门旅游城市', data: r })
    })
})
router.get('/fresh/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from fresh', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '新鲜甩尾', data: r })
    })
})
router.get(`/free_travel/`, (req, res, next) => {
    var obj  = req.query
    pool.query('select * from free_travel where deptid=?', [obj.deptid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '机酒自由行', data: r })
    })
})
router.get('/worth_travel/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from worth_travel', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '最世界·深度旅行', data: r })
    })
})
module.exports = router